// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLHint;
// import com.alibaba.druid.sql.ast.SQLObjectImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "SQLExprHint.h"
#include "../../visitor/SQLASTVisitor.h"

SQLExprHint::SQLExprHint()
{
}

SQLExprHint::SQLExprHint(SQLExpr_ptr expr)
{
  this->setExpr(expr);
}

SQLExpr_ptr SQLExprHint::getExpr()
{
  return expr;
}

void SQLExprHint::setExpr(SQLExpr_ptr expr)
{
  if (expr != nullptr)
  {
    expr->setParent(SharedObject(SQLExprHint));
  }

  this->expr = expr;
}

// @Override
void SQLExprHint::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLExprHint)))
  {
    acceptChild(visitor, expr);
  }
  visitor->endVisit(SharedObject(SQLExprHint));
}

SQLObject_ptr SQLExprHint::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<SQLExprHint>(new SQLExprHint());
  std::shared_ptr<SQLExprHint> x = std::dynamic_pointer_cast<SQLExprHint>(clone_tmp);
  // SQLExprHint x = new SQLExprHint();
  if (expr != nullptr)
  {
    x->setExpr(std::dynamic_pointer_cast<SQLExpr>(expr->clone()));
  }
  return x;
}
